const { override, fixBabelImports, addLessLoader, addWebpackPlugin  } = require('customize-cra');
const FileManagerWebpackPlugin = require('filemanager-webpack-plugin');

module.exports = override(
  fixBabelImports('import', {
    libraryName: 'antd-mobile',
    libraryDirectory: 'es',
    style: 'css',
  }),
  addLessLoader(),
  // 增加文件管理器插件(将生成的静态文件打成zip包,便于alibaba cloud toolkit更快的自动部署)
  addWebpackPlugin(new FileManagerWebpackPlugin({
    onEnd: {
      // 默认创建两个目录，否则直接执行yarn start会报错
      mkdir: ['./build', './build_zip'],
      archive: [
        { source: './build', destination: './build_zip/build.zip' },
      ]
    }
  })),
);
